package com.chapter8.example1;

public interface IFactory {
    Operation createOpetation();
}

/**
 * 每个操作都对应一个工厂
 */

class AddFactory implements IFactory{

    @Override
    public Operation createOpetation() {
        return new OperationAdd();
    }
}

class SubFactory implements IFactory{

    @Override
    public Operation createOpetation() {
        return new OperationSub();
    }
}

class MulFactory implements IFactory{

    @Override
    public Operation createOpetation() {
        return new OperationMul();
    }
}

class DivFactory implements IFactory{

    @Override
    public Operation createOpetation() {
        return new OperationDiv();
    }
}